<?php

/**
 * Historique filter form base class.
 *
 * @package    KC-INDICATEURS
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseHistoriqueFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'bug_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Bug'), 'add_empty' => true)),
      'bug_statut'           => new sfWidgetFormFilterInput(),
      'date_debut'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_fin'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_delta'           => new sfWidgetFormFilterInput(),
      'date_delta_ouverture' => new sfWidgetFormFilterInput(),
      'flag'                 => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'bug_id'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Bug'), 'column' => 'id')),
      'bug_statut'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'date_debut'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_fin'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_delta'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'date_delta_ouverture' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'flag'                 => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('historique_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Historique';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'bug_id'               => 'ForeignKey',
      'bug_statut'           => 'Number',
      'date_debut'           => 'Date',
      'date_fin'             => 'Date',
      'date_delta'           => 'Number',
      'date_delta_ouverture' => 'Number',
      'flag'                 => 'Text',
    );
  }
}
